import {defineStore} from 'pinia';
import {userInfoService} from '@/server/userService.js';

export const useUserInfoStore = defineStore("userInfoStore", {
    state() {
        return {
            userInfo: {
                uuid: ''
            }
        }
    },
    getters: {
        getUserInfo(state) {
            return state.userInfo;
        }
    },
    actions: {
        setUserInfo() {
            //获取用户信息
            userInfoService().then(res => {
                let data = res.data;
                if (data.code) {
                    //删除用户token
                    return;
                }

                this.userInfo = data.data;
            })
        }
    }
})